# coding=utf-8

import mysql.connector


# 创建数据库连接
mydb = mysql.connector.connect(
    host="localhost",
    port="3308",
    user="gentleuser",
    passwd="QAZ!@#qwe",
    database="runoob_db"
)
mycursor = mydb.cursor()

# 创建数据库
# mycursor.execute("CREATE DATABASE runoob_db")
# 检查连接情况
# mycursor.execute("SHOW DATABASES")
# 查询数据库并打印内容
mycursor.execute("select * from sites")
for x in mycursor:
    print(x)

